#!/bin/sh
#default python dir
pythonDir="/root/qinge/python/study"
contabPath=/etc/crontab
min=47
hour=23
data=`cat launchConfig.json`
for one in $data
do
  firstOne=`echo $one|cut -c 1`
  if [ $firstOne = '#' ]
  then
    continue
  fi
	varName=`echo $one|cut -d= -f 1`
	varValue=`echo $one|cut -d= -f 2`
	case $varName in
		pythonDir)
			pythonDir=$varValue
			;;
		*)
			;;
	esac
done
uploadDir="$pythonDir/static/upload"
downloadDir="$pythonDir/static/download"
launchSH=$pythonDir/launch.sh
echo "$min ${hour} * * * root /bin/rm -rf $uploadDir/*  " >> $contabPath
echo "$min ${hour} * * * root /bin/rm -rf $downloadDir/*  " >> $contabPath
echo "$min ${hour} * * * root cd $pythonDir && source $launchSH " >> $contabPath